import 'package:flutter/material.dart';

class Login extends StatefulWidget {
  const Login({Key? key}) : super(key: key);

  @override
  State<Login> createState() => _LoginState();
}

class _LoginState extends State<Login> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: Color.fromARGB(255, 192, 0, 0),
          title: Row(
            children: const [
              Expanded(
                child: TabBar(
                  indicatorColor: Color.fromARGB(255, 255, 255, 255),
                  indicatorSize: TabBarIndicatorSize.label,
                  tabs: <Widget>[
                    Tab(text: "密码登录"),
                    Tab(text: "验证码登录"),
                  ],
                ),
              )
            ],
          ),
        ),
        body: TabBarView(
          children: <Widget>[
            // 密码登录
            SingleChildScrollView(
              child: Column(
                children: [
                  const Padding(
                    padding: EdgeInsets.fromLTRB(30, 20, 30, 20),
                    child: Center(
                      child: FlutterLogo(
                        size: 150,
                      ),
                    ),
                  ),
                  const Padding(
                    padding: EdgeInsets.fromLTRB(30, 20, 30, 20),
                    child: TextField(
                      keyboardType: TextInputType.phone,
                      decoration: InputDecoration(
                        prefixIcon: Icon(Icons.phone_android_outlined),
                        fillColor: Color(0x30cccccc),
                        filled: true,
                        enabledBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00FF0000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                        hintText: '手机号',
                        focusedBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00000000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                      ),
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.fromLTRB(30, 20, 30, 20),
                    child: TextFormField(
                      obscureText: false,
                      keyboardType: TextInputType.visiblePassword,
                      decoration: const InputDecoration(
                        prefixIcon: Icon(Icons.lock),
                        prefixIconColor: Color.fromARGB(237, 201, 0, 0),
                        fillColor: Color(0x30cccccc),
                        filled: true,
                        enabledBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00FF0000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                        hintText: '密码',
                        focusedBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00000000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                      ),
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.all(50),
                    child: SizedBox(
                      height: 80,
                      width: 80,
                      child: RaisedButton(
                        splashColor: Color.fromARGB(255, 146, 0, 0),
                        color: Color.fromARGB(255, 0, 101, 216),
                        onPressed: () {
                          print('登录');
                        },
                        shape: CircleBorder(),
                        child: Icon(
                          Icons.login_rounded,
                          size: 30,
                          color: Color.fromARGB(255, 252, 252, 252),
                        ),
                      ),
                    ),
                  )
                ],
              ),
            ),
            // 验证码登录
            SingleChildScrollView(
              child: Column(
                children: [
                  const Padding(
                    padding: EdgeInsets.fromLTRB(30, 20, 30, 20),
                    child: Center(
                      child: FlutterLogo(
                        size: 150,
                      ),
                    ),
                  ),
                  const Padding(
                    padding: EdgeInsets.fromLTRB(30, 20, 30, 20),
                    child: TextField(
                      keyboardType: TextInputType.phone,
                      decoration: InputDecoration(
                        prefixIcon: Icon(Icons.phone_android_outlined),
                        fillColor: Color(0x30cccccc),
                        filled: true,
                        enabledBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00FF0000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                        hintText: '手机号',
                        focusedBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00000000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                      ),
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.fromLTRB(30, 20, 30, 20),
                    child: TextFormField(
                      obscureText: false,
                      keyboardType: TextInputType.visiblePassword,
                      decoration: const InputDecoration(
                        prefixIcon: Icon(Icons.lock),
                        prefixIconColor: Color.fromARGB(237, 201, 0, 0),
                        fillColor: Color(0x30cccccc),
                        filled: true,
                        enabledBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00FF0000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                        hintText: '验证码',
                        focusedBorder: OutlineInputBorder(
                            borderSide: BorderSide(color: Color(0x00000000)),
                            borderRadius:
                                BorderRadius.all(Radius.circular(100))),
                      ),
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.all(50),
                    child: SizedBox(
                      height: 80,
                      width: 80,
                      child: RaisedButton(
                        splashColor: Color.fromARGB(255, 146, 0, 0),
                        color: Color.fromARGB(255, 0, 101, 216),
                        onPressed: () {
                          print('登录');
                        },
                        shape: CircleBorder(),
                        child: const Icon(
                          Icons.login_rounded,
                          size: 30,
                          color: Color.fromARGB(255, 252, 252, 252),
                        ),
                      ),
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
